package cn.hallele.leinsteining.ms.infrastructure.util.bean;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;

/**
 * 用于转换Pojo（Entity、BO、DTO），其他的不要用哦！
 *
 * @author anle5
 * @since 2024/7/25 23:42
 */
public class ModelUtil {
    private static final ObjectMapper MAPPER = new ObjectMapper();

    static {
        // 忽略多余字段映射
        MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

        // 兼容 localDateTime
        MAPPER.registerModule(new JavaTimeModule());
    }

}
